Repository navigation
fix(ui): the view / page-block filter editor offers a multiple: true field membership only - #36182
Conversation
… field membership only FilterBuilderField forwards each field's declared multiple to the shared FilterBuilder, and every host that builds its field list carries it. Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…olumn, per host Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
…r pins Claude-Session: https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 Final green head · area a4-D · 2026-11-21T20:32Z |
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5oVqoTJkrRZcyZS4xd 席位核对 — ACCEPT · head b8e29a3
|
|
repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 席位核对Landing · area a4-D · 2026-11-21T20:35Z · head
Ready + auto-merge now. |
… on a list field (objectstack-ai#36185) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XP3RHGWUG7UH3fNa4tBa9UC)_ Part of objectstack-ai#36167 — the builder half. The card's Done-when also names `validateExpression` refusing a list compared with a scalar; that half narrows an accept set and is not built here: the seat picked option A on the card (7068927390), and area a4-C claimed it (7068951634) under its own `Part of objectstack-ai#36167`. Clause-②: no Metadata-protocol: none ## 维护者速读 - 在 Studio 里给多值字段(多选、标签、多选人员或多选关联)写条件时,操作符从「等于 / 不等于」换成「包含 / 不包含 / 为空 / 不为空」;单值字段不变。 - 属于 Studio 条件编辑器:多值字段上的「等于」永远不成立、作者毫无提示,这次让编辑器只给出能真正命中的写法。 - 已保存的「多值字段 等于 某值」条件会改为在表达式框里原样打开,不会被改写;若有问题,作者看到的是表达式框而非行编辑器,可直接撤回本改动。 - 要你做的:决定是否另做「保存时拒绝多值字段与单值比较」的那一半(见卡片报告里的待决问题)。 ## What changes - `ConditionBuilder` (the Studio CEL condition builder behind hook, validation-rule, action visibility, page-block and flow entry conditions) now offers a **list subject** (a `multiselect` / `checkboxes` / `tags`, or a `select` / `lookup` / `user` declared `multiple: true`) exactly what the shared filter builder offers it: contains, does not contain, is empty, is not empty. `==` / `!=` / ordering are no longer offered there. Which operators a list takes is read from `jsonColumnFilterOperators` (through the new `listSubjectOperators`), not restated; a small table only translates those names onto the builder's own operator values. - Contains writes `S != null && V in S`, does not contain writes `S == null || !(V in S)`. That is the spelling the flow edge's rows shipped; it now lives in one module, `inspectors/cel-list-membership.ts` (`listMembershipCel` / `readListMembership` / `listSubjectOperators`), and `flow-edge-condition-rows.ts` writes through it too (its output is byte-for-byte unchanged; its existing pins hold). - A row moved onto a list subject leaves `equals` for `contains`; moved off a list, membership becomes `equals`. An operator offered on both sides (is empty / is not empty) stays, re-spelled for the new field. - A stored condition whose row uses an operator its subject is not offered (for example `record.labels == 'frontend'` on a list, or membership on a single-value field) opens in the raw expression editor exactly as stored: never rewritten, nothing emitted. - New studio locale key `engine.inspector.condition.op.notContains` (en, zh). ## Tests - New pin `ConditionBuilder.listSubject-36167.test.tsx` (27 tests): each of six list subjects offers the shared builder's list set and nothing else; three single-value controls keep equals / not equals and get no membership; the written CEL equals what the flow edge's `rowsToCel` writes for the same row and is evaluated by `celEngine` (member true, non-member false, `[]` and `null` null-safe both ways); stored membership round-trips; stored `==` / `!=` on a list and membership on a single-value field open raw and verbatim; an instrument control shows the replaced `==` answering a constant. - Fixture triage: three existing pins (`ConditionBuilder.typedEmptyOps-11894`, two cases; `ObjectValidationsPanel.typedEmptyOps-11894`, one case) seeded a list subject's row as `S == 'x'` only to reach its operator dropdown. That seed now opens in the raw editor, so it became the membership row; what each case pins (the empty check on a list, and that `multiple` reaches the builder) is unchanged and still needs the flag to reach the builder. ## Acceptance notes - Re-measured under `celEngine` (objectstack tree at this branch): `'a' in S` with `S = null` faults (no such overload for `string in` a null dyn), with `S = []` answers false; `S == 'a'` is false for `['a','b']` and for `null`; `S.contains('a')` faults on a list. Hence the null guard on both membership spellings. - A stored `S == null` / `S != null` on a list subject also opens raw now (the builder's own spelling for it is is empty / is not empty). Unchanged bytes, by the round-trip rule. - The schema-driven condition widget's catalog (`ResourceEditPage`'s object fetch) dropped `multiple` on this branch's base. objectstack-ai#36182 (merged to `main` as 865df27) closes it: the fetch now goes through `objectCatalogOf`, which carries `multiple: true`, and the condition widget hands that catalog to `ConditionBuilder` unprojected, so after this PR lands a `select` / `lookup` / `user` declared `multiple: true` is a list subject at that mount too. `multiselect` / `checkboxes` / `tags` are lists by type alone. The hook, page-block, action, flow-entry and validation-panel mounts carry `multiple`. - `node scripts/pm/overlap-check.mjs` reports a textual overlap with draft PR objectstack-ai#35923 on the studio en / zh catalogues (different keys). Not merged around. ## Verification Read first (risk order): 1. `ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx`: `initFrom` (the new offered-operator check that sends a stored row to the raw editor) and `withOfferedOp` on a subject change. 2. `ui/packages/app-shell/src/views/metadata-admin/inspectors/cel-list-membership.ts`: the shared spelling and reader. 3. `ui/packages/app-shell/src/views/metadata-admin/inspectors/flow-edge-condition-rows.ts`: now writes through the shared module. Two-minute check: `pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.listSubject-36167.test.tsx` — expect 27 passed. Local readings at `ef21bbcb31` (objectstack tree): <details><summary>Tests, type-check, ablation</summary> - `ConditionBuilder.listSubject-36167.test.tsx`: 27 passed. All `inspectors/ConditionBuilder*`, `flow-edge-condition-rows*`, `FlowEdgeInspector*` suites: 22 files, 262 tests passed (two locked runs; five suites first failed to collect on an unbuilt `@objectstack/client`, passed once it was built). - Mount-site suites (`ObjectValidationsPanel*`, `FlowNodeConfigField*`, `HookDefaultInspector*`, `ActionDefaultInspector*`, `PageBlockInspector.visibleWhen*`, `FlowNodeInspector.entryCondition*`, `widgets*ondition*`): 33 files, 323 passed, 1 failed before triage (the `ObjectValidationsPanel.typedEmptyOps-11894` list seed); after triage that file passes, run with `packages/i18n/` (106 files, 1967 passed) and with `ui/scripts/` (175 files, 5126 passed). - `pnpm --filter @object-ui/app-shell type-check` and `pnpm --filter @object-ui/i18n type-check`: exit 0 (lock VERDICT command-exit 0). - Ablation (one-off, restored byte-identical to the HEAD blob): deleting the list branch of `opChoicesFor` through `scripts/ablation-replace.mjs` (anchor 1 to 0) turns the new pin 19 failed / 8 passed of 27; the 8 are the single-value controls, the instrument control and the raw-open cases. </details> <details><summary>Gates</summary> `node scripts/pm/dispatch-gates.mjs --commands` (diff-derived, 38 families) all exit 0 at `ef21bbcb31`; `--ran` reconciliation: 38 derived, 38 run, 0 NOT-MEASURED (a derived zero). `pnpm --dir ui check:new-line-citations`: 0 new. ESLint on the changed files: 0 errors (warnings pre-existing). CI runs the full farm. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01FEkQ5okniknzVVR3KTSVr1)_ <!-- signed: repo:objectstack#4 · os-project-manager · session_01FEkQ5okniknzVVR3KTSVr1 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Leehom · project thread
Fixes #36169
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
A
select/lookup/userfield declaredmultiple: truestores a list. Studio's view and page-block filter editor (FilterBuilderField, thefilter-builderwidget) built its field list withoutmultiple, so the sharedFilterBuildertreated such a field as single-value and offeredEquals/Is any of, which the data door refuses on a list (400INVALID_FILTER, measured on that door by the condition-editor half of this family, PR #36165).FilterBuilderFieldnow forwards each field'smultipleexactly as PR #36165 did for the other editors, and the builder offersjsonColumnFilterOperators' set (Contains, Does not contain, Is empty, Is not empty). No operator table is copied: the set isoperatorsForField's answer.Measured where the field list is built (the dispatch assumed two call sites in one file):
FilterBuilderFieldhas three call sites in two files, and its field list is built in five places. Each now carries the servedmultiple:interfaceConfig.filterBy, tab presets (filter-mode), any form row withwidget: filter-builderobjectCatalogOfinResourceEditPage.tsx(extracted from the inline loader so it can be pinned)ObjectListViewInspector.tsxfield catalogfilterViewVariantInspector.tsxwidget contextmapObjectFieldsinViewConfigPanel.tsxrecord:related_listblockfilterFilterRulesFieldinPageBlockInspector.tsx(already readsuseObjectFields, which carriesmultiplesince PR #36165)Read-back of a stored
equals/inrule on a list column: this editor has no Source fallback (unlikedatasetFilterCondition). It hands the stored rule to the builder as stored; the builder mounts the row's own operator beside the offered set (offeredOperatorsForRow), so the rule opens as anEqualsrow the author can change toContains, and opening it writes nothing. Pinned.Read first, by risk:
ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx—objectCatalogOf: the loader body moved verbatim into an exported function, plus themultipleprojection. Check the record and array branches still readnamethe same way.ui/packages/app-shell/src/views/metadata-admin/widgets.tsx— thefbFieldsforward andObjectFieldOption.multiple.ui/packages/app-shell/src/views/ViewConfigPanel.tsx—mapObjectFieldsis now exported (marked internal, for the pin).Two-minute check:
pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/widgets.filterBuilderMultiple-36169.test.tsx— expect 12 passed.Tests
New file named for the card,
widgets.filterBuilderMultiple-36169.test.tsx(no shared harness file exists forFilterBuilderField; its other pins are card-named files):multiple: trueuser / lookup / select column's real operator dropdown equalsoperatorsForField's labels (the four); CONTROLS: single-value user / select columns keepEqualsand stay inside their type bucket;equalsrule onownersopens as its row, writes nothing, and its dropdown listsEqualsplus the four;objectCatalogOf(record and array forms) andmapObjectFieldsmark exactly themultiple: truecolumns; the view-variant inspector, the page block's related-list filter and the Studio list-view inspector (realMetadataClientover a served object) each offer a list column the four.Reverse verification (one mutation per site, on the committed fix)
Each
multipleprojection was deleted in turn withscripts/ablation-replace.mjs(anchor hit 1 to 0, blob moved), the file ran, and the tool restored it (git checkout HEAD, blob equals HEAD,git diff HEADempty):FilterBuilderFieldforward: 7 failed / 5 passed (the passing five: the helper's own answer, the two single-value controls, the two catalog unit pins);objectCatalogOf: 5 failed (the four widget cases built from that catalog, and its unit pin);mapObjectFields: 2 failed (its unit pin, the view-variant case fed by it);ViewVariantInspector: 1 failed (its case);PageBlockInspector: 1 failed (its case);ObjectListViewInspector: 1 failed (its case).The first attempt at the
ViewVariantInspectorandPageBlockInspectormutations deleted the closing brackets with the spread and failed to transform ("no tests"): void, not counted; redone with an anchor on the spread alone.Affected suites
At
903d9ca0(the final headb8e29a32adds one module-top import to the new test file):pnpm --dir ui exec vitest run --maxWorkers=2over the existing suites of every edited component (widgets*,ResourceEditPage*,ViewConfigPanel*,PageBlockInspector*,ViewVariantInspector*,ObjectListViewInspector*,ListView*,StudioDesignSurface.listViewInspector*,viewFilterOrGroup*,WidgetContext*,SchemaForm*) → Test Files 137 passed (137), Tests 933 passed (933). The new file atb8e29a32: 12 passed (12). The full@object-ui/app-shellsuite is CI's (Test UI).Acceptance notes
$eq/$inon a list column at the data door is PR fix(ui): condition editors offer a multiple: true field only what its evaluator answers #36165's measurement on the same door (showcase, SqlDriver). This PR measures the Studio offer only (the pins above); no backend was booted.objectCatalogOf), the view-variant inspector and the page block'sFilterRulesFieldalso leave out each field'soptions, which the list-view inspector carries (the objectstack#27515 picklist value picker). On those hosts a picklist column gets a free-text value box. Not this card's mechanism (multiple), not measured in a running app; listed in the report.ObjectFieldOptiongains an optionalmultiple; thefield-ref/field-multipickers read name, label and type only, so they are unchanged.Verification
Local gates
All 39 families from
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackexited 0, each exit code captured before any pipe.check:test-source-aliasfirst exited 1 (the new test reached the lazy@objectstack/lintimport throughResourceEditPage); fixed with a module-top import and re-run on the final head: exit 0.check:type-check-coverage,check:type-check-debt,check:undeclared-dep-imports,check:cross-package-test-inputsandcheck:nul-bytesre-run on the final head: exit 0.--ranreconciliation: 39 derived, 39 run, 0 NOT-MEASURED (a derived zero, every family recorded an exit code). After the@object-ui/app-shell^...closure was built,pnpm --filter @object-ui/app-shell run type-checkexited 0 at903d9ca0(thesrcprogram andtsconfig.test.json); the final head adds only a side-effect import to the test.ui/scripts/check-new-cross-file-line-citations.mjs: 0 new citations.Generated by Claude Code